FILE: 	READ.ME FOR PARTISAN POLARIZATION ON BLACK SUFFRAGE, 1785-1868
AUTHOR: DAVID A. BATEMAN
DATE: 	FEBRUARY 26, 2019 (THIS VERSION)

*********************************************************************************	
File outlines the steps to reproduce Tables and Figures in:

"Partisan Polarization on Black Suffrage, 1785-1868" 
- David A. Bateman

*********************************************************************************	
There are 25 files, command and data, needed to replicate the analyses 
in the main text. These are first listed, and then described in more detail.

*********************************************************************************	
All data analyses in this article were carried out using either 
Stata IC/13.1 for Windows or .R Version 3.4.2. 
*********************************************************************************	

FULL LIST OF DATA FILES:

1. SuffrageQualifications.dta
2. SuffrageVotes.dta
3. Referenda.dta
4. perFPOC1840.dta
5. perFPOC1840Midatlantic.dta
6. MapsVotingData.dta

(codebook included)

FULL LIST OF COMMAND FILES:
1. BlackSuffrage.do
2. Maps.R
3. VTR .ado files (by Won-ho Park [2003/2008])

FULL LIST OF SHAPEFILES:
1. Counties1840.shp (and subsidiaries)
2. FreeSoil1848.shp (and subsidiaries)
3. Liberty1844.shp (and subsidiaries)
4. Republican1856.shp (and subsidiaries)
5. States1840.shp (and subsidiaries)
6. StatesXXXX.shp (and subsidiaries)
7. SuffrageCounties.shp (and subsidiaries)

FULL LIST OF LOG FILES
1. LogBlackSuffrage.txt
2. LogMaps.docx

*********************************************************************************	
TABLES 1, 2, AND 4 / FIGURES 1, 3, 4, AND 5

The primary command file is BlackSuffrage.do. 

Step One: 	The command file begins by opening
		"SuffrageQualifications.dta" and using this to produce 	
		Figure 1, a timeline of how many states had 
		property or racial qualifications for the right
		to vote. This file simply counts how many and what 
		proportion of states and territories had these
		qualifications in any given year. The underlying data is 
		from Keyssar (2000) and various secondary and primary 
		sources indicated in the text of the article.

		Figure 1 is messy, with state labels overlapping each 
		other. These were edited in Adobe Illustrator after 
		Figure 1 was produced.


Step Two: 	The command file then opens "SuffrageVotes.dta", the 
		primary file used in the main empirical analyses. This  
		file has individual level voting data on black suffrage, 
		compiled by the author by closely examining state 
		legislative journals.

		The command file reshapes the data so that each legislative 
		vote cast by an individual legislator/delegate is counted as 
		a unique observation. The main variable of interest is bsuff, 
		a dummy variable for whether a legislator voted in favor (1) 
		or against (0) African American voting rights.

		The left panel of Figure 3 is produced by generating five-year 
		intervals and regressing legislator vote choice by these intervals 
		interacted with party affiliation. The right panel of Figure 3 is 
		produced by estimating a quantile regression of each legislator's 
		ideal point - produced using the IDEAL package in R across all votes 
		cast in a legislative session - on the five year intervals interacted 
		with vote choice, identifying the location of the median pro- and 
		anti-suffrage voter across these intervals.

Step Three: 	Using the same "SuffrageVotes.dta" file, the command file then 
		estimates the different models included in Table 1. These are 
		linear regressions of legislator vote choice across three different 
		periods and with different variables included in the right side of 
		the equation. The demographic and political variables come primarily 
		from Haines and ICPSR (2010), ICPSR (1999). In most cases the 
		political and demographic data was at the county level, but for 
		states where the legislative districts were not counties or 
		aggregations of counties this information had to be collected 
		from contemporary newspaper reports (www.newspapers.com) or closer 
		inspection of the relevant Census report from www.census.gov.

		The different models use bootstrapped standard errors with 
		chamber-year fixed effects. 
		
		The models were Model 1 - 1785-1825 (North); Model 2 - 1785-1825 
		(South & Congress); Model 3 - 1830-1840 (South); Model 4 - 1830-1855 
		(North); Model 5 - 1830-1855 (North); and Model 6 - 1856-1869 
		(North & Congress).		

		These are saved in "Table1.rtf". 

Step Four: 	Again using "SuffrageVotes.dta", the command file the produces 
		estimates of the interaction models shown in Table 2. These have 
		the same specification as Table 1 but a different variable is 
		interacted with a legislator's party affiliation in each. 

		Model 1 - Slavery in South; Model 2 - Slavery in North, before 1825; 
		Model 3 - Liberty Party in 1844; Model 4 - Free Soil in 1848; Model 5 - Manufacturing.

		The Table is saved as "Table2.rtf". 

		Figure 4 is produced by estimating the marginal effects of Model 1 
		(left panel) and Model 4 (right panel). 

Step Five: 	The remaining steps in this command file use "Referenda.dta", which 
		contains county/town and ward level data on voting in black suffrage 
		referenda before 1860. 

		The ecological regression relies on several .ado file programs written 
		by Won-ho Park on the basis of their 2008 dissertation, "Ecological 
		Inference and Aggregate Analysis of Elections." The .ado files  
		including all of the necessary programs has been included in the data, 
		uploads. These should be placed in the user's personal .ado folder 
		(often c:\ado\personal\).  

		The program estimates voter transition rates or average 
		voter transition rates when more than one state is included.

		The relevant tables are saved in "Table4.rtf". These are simply 
		appended on top of each other, and so were modified slightly in 
		their layout after the tables had been produced.

		*** TABLE 3 IS NOT PRODUCED USING THIS DATA, WHICH IS INCOMPLETE AT THE
		*** COUNTY AND TOWN LEVEL. IT WAS INSTEAD PRODUCED USING CONTEMPORARY
		*** NEWSPAPER REPORTS AND SECONDARY SOURCES.

Step Six: 	The "Referenda.dta" file is then used to produce Figure 6. The only 
		modification made is that many of the referenda were held immediately 
		before the organization of the Free Soil party. The results from 
		non-simultaneous elections with the Free Soil party are included in 
		Figure 6(d). 
		
		Six separate figures are produced, and these are combined into 
		Figure 6.

*** WITH THIS THE COMMAND FILE "BLACKSUFFRAGE.DO" IS COMPLETED.***
*** THE LOG FILE FOR THIS IS "LogBlackSuffrage.txt"
*********************************************************************************
Step Seven: 	The remaining steps involve the creation of Figures 2 and 5, 
		both of which use county-level historical shapefiles from ----
		.
		
		Open Maps.R in R. 

		This command file will run through the steps needed to produce
		both Figure 2 and the multiple panels included in Figure 5. 
		
		Figure 2 is a point map of the approximate county-level
		distribution of the Free African American population in 1840. 
		Because of the lack of township shapefiles, some clustering at 
		the county-level is visible. 

		An inset making the heavily populated Mid-Atlantic region
		is also included.

		In addition to the shapefiles, the file also relies on population
		data at the county level. This is from Haines and ICPSR (2010)
		and linearly extrapolated between 1840 and 1850 to arrive at the year 1843. 
		This year was chosen because it was the last moment before the onset of
		fights over re-enfranchisement.

Step Eight: 	The next step taken by the command file Maps.R is to generate
		the various maps that will be used in Figure 5. 

		The data for this comes from ICPSR (1999) and from SuffrageVotes.dta.
		The basic data, however, is the county-level vote for the Liberty
		Party, the Free Soil Party, and the Republicans in 1844, 1848, and 1856.
		
		Four separate figures are generated and compiled into Figure5.pdf.	

*** WITH THIS THE COMMAND FILE "MAPS.R" IS COMPLETED.***
*** THE LOG FILE FOR THIS IS "LogMaps.docx", PRODUCED USING THE 
*** MARKDOWN/COMPILE FUNCTION OF RSTUDIO.

Please address any remaining questions to: 

David A. Bateman
dab465@cornell.edu
February 26, 2019